package com.example.propertymangesystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.propertymangesystem.domain.property;
import com.example.propertymangesystem.mapper.propertyMapper;
import com.example.propertymangesystem.service.IPropertyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class propertyServiceImpl extends ServiceImpl<propertyMapper, property> implements IPropertyService {
    @Autowired
    private propertyMapper propertyMapper;

    @Override
    public IPage<property> getPage(Integer current, Integer size, property property) {
        QueryWrapper<property> qw = new QueryWrapper<>();
        qw.like(property.getId() != null , "id", property.getId());
        qw.like(property.getEid() != null , "eid", property.getEid());
        qw.like(property.getPid() != null , "pid", property.getPid());
        qw.like(property.getName() != null , "name", property.getName());
        qw.like(property.getInfo() != null , "info", property.getInfo());
        qw.like(property.getSave() != null , "save", property.getSave());
        IPage page = new Page(current, size);
        return propertyMapper.selectPage(page, qw);
    }
}
